package com.um2.simplexe.client.plugin.console;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import javax.swing.JScrollPane;
import javax.swing.JRadioButton;
import javax.swing.JLabel;
import java.awt.Dimension;
import javax.swing.BoxLayout;
import javax.swing.BorderFactory;
import javax.swing.border.BevelBorder;
import java.awt.Font;

public class Console extends JPanel {

	private static final long serialVersionUID = 1L;
	private JTextArea zoneFormule = null;
	private JScrollPane panneauFormule = null;
	private GlpkSolver solver;
	private ButtonGroup groupeBouton;
	private JRadioButton boutonCP = null;
	private JRadioButton boutonMP = null;
	private JLabel labelCP = null;
	private JLabel labelMP = null;
	private JPanel panneauChoix = null;
	/**
	 * This is the default constructor
	 */
	public Console() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(400, 400);
		this.setLayout(new BorderLayout());
		this.setName("Console");
		this.add(getPanneauChoix(), BorderLayout.NORTH);
		this.add(getPanneauFormule(), BorderLayout.CENTER);
		groupeBouton.add(boutonCP);
		groupeBouton.add(boutonMP);
	}

	/**
	 * This method initializes zoneFormule	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getZoneFormule() {
		if (zoneFormule == null) {
			zoneFormule = new JTextArea();
			zoneFormule.setText("");
			zoneFormule.setFont(new Font("Dialog", Font.PLAIN, 18));
		}
		return zoneFormule;
	}

	/**
	 * This method initializes panneauBouton	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getPanneauBouton() {
		if (panneauChoix == null) {
			labelMP = new JLabel();
			labelMP.setText("GNU MathProg");
			labelCP = new JLabel();
			labelCP.setText("CPLEX LP");
		}
		return panneauChoix;
	}

	/**
	 * This method initializes panneauFormule	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getPanneauFormule() {
		if (panneauFormule == null) {
			panneauFormule = new JScrollPane();
			panneauFormule.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
			panneauFormule.setName("");
			panneauFormule.setViewportView(getZoneFormule());
		}
		return panneauFormule;
	}

	/**
	 * This method initializes boutonCP	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getBoutonCP() {
		if (boutonCP == null) {
			boutonCP = new JRadioButton();
		}
		return boutonCP;
	}

	/**
	 * This method initializes boutonMP	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getBoutonMP() {
		if (boutonMP == null) {
			boutonMP = new JRadioButton();
		}
		return boutonMP;
	}

	/**
	 * This method initializes panneauChoix	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getPanneauChoix() {
		if (panneauChoix == null) {
			panneauChoix = new JPanel();
			panneauChoix.setLayout(new BoxLayout(getPanneauChoix(), BoxLayout.X_AXIS));
			panneauChoix.setPreferredSize(new Dimension(100, 42));
			panneauChoix.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
			panneauChoix.add(labelCP, null);
			panneauChoix.add(getBoutonCP(), null);
			panneauChoix.add(labelMP, null);
			panneauChoix.add(getBoutonMP(), null);
		}
		return panneauChoix;
	}

}
